import { Button } from "antd";
import React from "react";
interface AppExConfig {
  type: "primary" | "warning" | "danger" | "info";
  order: number;
}
// interface Person {
//   name: "John";
//   age: 11;
// }
type Person = {
  name: string;
  age: number;
};
type PersonEx = Person & {
  sex: string;
};
export default class AppEx extends React.Component<AppExConfig> {
  static defaultProps: AppExConfig = {
    type: "primary",
    order: 11,
  };
  constructor(props: AppExConfig) {
    super(props);
    this.state = {
      person: {
        name: "John",
        age: 11,
        sex: "male",
      } as Partial<PersonEx>,
      hobbies: [2, 3, 4, 5],
      round: "go",
    };
  }
  /*    this.setState({
      value: e.target.value,
    }); */
  go = () => {
    console.log("go");
    this.state.person.age = 14;
    // this.setState(this.state);
  };
  render(): React.ReactNode {
    return (
      <>
        <button>{this.props.type}</button>
        <button>{this.state.person.name}</button>
        <button>{this.state.person.age}</button>
        <button onClick={this.go}>go</button>
        <Button type="primary">xx</Button>
      </>
    );
  }
}
